import { CyCfs } from "@/basedata/entities/basedatum.entity";
import { FeeDet } from "@/business/entities/business.entity";
import { YhBaseEntity } from "@/common/baseentity";
import { decimalTransformer } from "@/common/transform/DecimalTransformer";
import { BooleanType, RepairStatusType } from "@/common/type/enum";
import { Column, Entity, Index, JoinColumn, ManyToOne, OneToMany, PrimaryColumn } from "typeorm";

@Entity({
    name: 'truck_cntr_plan'
})
export class CntrPlan extends YhBaseEntity {
    @Column({
        type: 'datetime',
        name: 'plan_date',
        comment: '计划日期'
    })
    plan_date: Date;

    @Column({
        type: 'char',
        name: 'carry_id',
        comment: '计划类型'
    })
    carry_id: string;

    @Column({
        type: 'varchar',
        name: 'stat_cod',
        comment: '作业目的'
    })
    stat_cod: string;
    /* @Column({
        type: 'char',
        name: 'e_f_id',
        comment: '空重'
    })
    e_f_id: string; */

    @Column({
        type: 'char',
        name: 'cntr_siz_cod',
        comment: '箱尺寸'
    })
    cntr_siz_cod: string;

    @Column({
        type: 'char',
        name: 'cntr_typ_cod',
        comment: '箱型'
    })
    cntr_typ_cod: string;

    @Column({
        type: 'int',
        name: 'cntr_num',
        comment: '箱量'
    })
    cntr_num: number;    

    @Column({
        type: 'int',
        name: 'cfs_cod',
        comment: '站点'
    })
    cfs_cod: number;

    @Column({
        type: 'varchar',
        name: 'bill_no',
        comment: '提/放箱单号'
    })
    bill_no: string;

    @Column({
        type: 'varchar',
        name: 'dam_id',
        comment: '箱况'
    })
    dam_id: string;

    @Column({
        type: 'varchar',
        name: 'plan_name',
        comment: '计划名称',
    })
    plan_name: string;

    /* @Column({
        type: 'char',
        name: 'plan_kind',
        comment: '计划类型'
    })
    plan_kind: string; */

    @Column({
        type: 'int',
        name: 'cntr_owner',
        comment: '成本中心'
    })
    cntr_owner: number;

    /* @Column({
        type: 'char',
        name: 'lock_id',
        comment: '锁箱'
    })
    lock_id: string; */

    @Column({
        type: 'int',
        name: 'cntr_work_num',
        comment: '已作业箱量'
    })
    cntr_work_num: number;


    /* @Column({
        type: 'varchar',
        name: 'trade_id',
        comment: '贸易性质'
    })
    trade_id: string;
    @Column({
        type: 'int',
        name: 'from_plac',
        comment: '来箱地点ID'
    })
    from_plac: number;
    @Column({
        type: 'int',
        name: 'to_plac',
        comment: '发往地点'
    })
    to_plac: number;

    @Column({
        type: 'varchar',
        name: 'spec_no',
        comment: '特殊号码'
    })
    spec_no: string */
    @Column({
        type: 'int',
        name: 'cntr_corp_cod',
        comment: '客户'
    })
    cntr_corp_cod: number;  
    @Column({
        type: 'int',
        name: 'free_days',
        comment: '免费天数'
    })
    free_days: number;
    @Column({
        type: 'decimal',
        name: 'day_rate',
        comment: '出租费率',
        transformer: decimalTransformer
    })
    day_rate: number;   
    @Column({
        type: 'varchar',
        name: 'currency_cod',
        comment: '货币'
    }) 
    currency_cod: string;
    
    @Column({
        type: 'char',
        name: 'finish_id',
        comment: '完成标志'
    })
    finish_id: string;
    @Column({
        type: 'varchar',
        name: 'need_email',
        comment: '是否自动发送邮件'
    })
    need_email: string;
    
    @OneToMany(() => CntrPlanCntr, (planCntr) => planCntr.plan)
    preCntrs: CntrPlanCntr[];

    @OneToMany(() => CntrPlanFee, (planFee) => planFee.plan)
    fees: CntrPlanFee[];

    @OneToMany(() => PortCntrStat, (portcntrstat) => portcntrstat.plan)
    portcntrstats: PortCntrStat[];

}

@Entity({
    name: 'v_truck_cntr_inplan'
})
export class CntrInPlan extends CntrPlan {
    @Column({
        type: 'int',
        name: 'cntr_oper_cod',
        comment: '供应商'
    })
    cntr_oper_cod: number;
    @Column({
        type: 'varchar',
        name: 'in_reason',
        comment: '进场原因'
    })
    in_reason: string;
    /* @Column({
        type: 'int',
        name: 'free_days',
        comment: '免费堆存天数'
    })
    free_days: number;

    @Column({
        type: 'decimal',
        name: 'day_rate',
        comment: '堆存费率',
        transformer: decimalTransformer
    })
    day_rate: number; */

    @OneToMany(() => Cntr, (cntr) => cntr.inplan)
    cntrs: Cntr[];
}

@Entity({
    name: 'v_truck_cntr_outplan'
})
export class CntrOutPlan extends CntrPlan {
    /* @Column({
        type: 'int',
        name: 'cntr_corp_cod',
        comment: '客户'
    })
    cntr_corp_cod: number;   */  
    /* @Column({
        type: 'int',
        name: 'free_days',
        comment: '免费天数'
    })
    free_days: number;
    @Column({
        type: 'decimal',
        name: 'day_rate',
        comment: '出租费率',
        transformer: decimalTransformer
    })
    day_rate: number;     */
}

@Entity({
    name: 'v_truck_cntr_leaseplan'
})
export class CntrLeasePlan extends CntrPlan {
    @Column({
        type: 'int',
        name: 'cntr_corp_cod',
        comment: '客户'
    })
    cntr_corp_cod: number; 
    /* @Column({
        type: 'int',
        name: 'free_days',
        comment: '免费天数'
    })
    free_days: number;

    @Column({
        type: 'decimal',
        name: 'day_rate',
        comment: '出租费率',
        transformer: decimalTransformer
    })
    day_rate: number; */    

    @OneToMany(() => CntrLease, (cntrlease) => cntrlease.leaseplan)
    leasecntrs: CntrLease[];

}
@Entity({
    name: 'v_truck_cntr_rentplan'
})
export class CntrRentPlan extends CntrPlan {
    @Column({
        type: 'int',
        name: 'cntr_corp_cod',
        comment: '客户'
    })
    cntr_corp_cod: number; 
    /* @Column({
        type: 'int',
        name: 'free_days',
        comment: '免费天数'
    })
    free_days: number;

    @Column({
        type: 'decimal',
        name: 'day_rate',
        comment: '堆存费率',
        transformer: decimalTransformer
    })
    day_rate: number;   */  

    @OneToMany(() => CntrLease, (cntrlease) => cntrlease.rentplan)
    leasecntrs: CntrLease[];
   

}
@Entity({
    name: 'truck_cntr_plan_cntr'
})
@Index(["truck_sn", "cntr"], { unique: true })
export class CntrPlanCntr extends YhBaseEntity {
    @Column({
        type: 'int',
        name: 'truck_sn',
        comment: '计划编号'
    })
    truck_sn: number;

    @Column({
        type: 'int',
        name: 'cntr_no',
        comment: '箱编号'
    })
    cntr_no: number;

    @Column({
        type: 'varchar',
        name: 'cntr',
        comment: '箱号'
    })
    cntr: string;

    @Column({
        type: 'char',
        name:'used_id',
        comment: '已使用'
    })
    used_id: string;

    @ManyToOne(() => CntrPlan, (cntrPlan) => cntrPlan.preCntrs)
    @JoinColumn({
        name: 'truck_sn'
    })
    plan: CntrPlan;
}

@Entity({
    name: 'truck_cntr_plan_fee'
})
export class CntrPlanFee extends YhBaseEntity {
    @Column({
        type: 'int',
        name: 'truck_sn',
        comment: '计划编号'
    })
    truck_sn: number;

    @Column({
        type: 'int',
        name: 'fee_unit_cod',
        comment: '客户'
    })
    fee_unit_cod: number;

    @Column({
        type: 'char',
        name: 'fee_in_out',
        comment: '费用I/O'
    })
    fee_in_out: string;
    @Column({
        type: 'int',
        name: 'fee_owner',
        comment: '成本中心'
    })
    fee_owner: number;
    @Column({
        type: 'varchar',
        name: 'fee_typ_cod',
        comment: '费用类型'
    })
    fee_typ_cod: string;

    @Column({
        type: 'varchar',
        name: 'fee_cod',
        comment: '费目'
    })
    fee_cod: string;

    @Column({
        type: 'char',
        name: 'currency_cod',
        comment: '货币'
    })
    currency_cod: string;

    @Column({
        type: 'char',
        name: 'fee_pay_kind',
        comment: '结费方式'
    })
    fee_pay_kind: string;

    @Column({
        type: 'decimal',
        name: 'amount',
        comment: '金额',
        transformer: decimalTransformer
    })
    amount: number; 

    @ManyToOne(() => CntrPlan, (cntrPlan) => cntrPlan.fees)
    @JoinColumn({
        name: 'truck_sn'
    })
    plan: CntrPlan;


}

@Entity({
    name: 'cntr_file'
})
export class Cntr extends YhBaseEntity {
    @Column({
        type: 'varchar',
        name: 'cntr',
        comment: '箱号'
    })
    cntr: string;

    @Column({
        type: 'varchar',
        name: 'current_stat',
        comment: '箱状态'
    })
    current_stat: string;

    /* @Column({
        type: 'varchar',
        name:'e_f_id',
        comment: '空重'
    })
    e_f_id: string; */

    /* @Column({
        type: 'varchar',
        name: 'cntr_plac',
        comment: '箱位'
    })
    cntr_plac: string; */

    @Column({
        type: 'varchar',
        name: 'in_dam_id',
        comment: '进场箱况'
    })
    in_dam_id: string;

    @Column({
        type: 'varchar',
        name: 'dam_id',
        comment: '当前箱况'
    })
    dam_id: string;

    @Column({
        type: 'char',
        name: 'cntr_siz_cod',
        comment: '箱尺寸'
    })
    cntr_siz_cod: string;

    @Column({
        type: 'char',
        name: 'cntr_typ_cod',
        comment: '箱型'
    })
    cntr_typ_cod: string;

    @Column({
        type: 'int',
        name: 'cntr_oper_cod',
        comment: '供应商'
    })
    cntr_oper_cod: number;

    @Column({
        type: 'int',
        name: 'cntr_corp_cod',
        comment: '客户'
    })
    cntr_corp_cod: number;

    @Column({
        type: 'decimal',
        name: 'cntr_hire_rate',
        comment: '租箱费率'
    })
    cntr_hire_rate: number;

    /* @Column({
        type: 'varchar',
        name: 'pre_tak_id',
        comment: '箱预定/提/装状态'
    })
    pre_tak_id: string;

    @Column({
        type: 'char',
        name: 'lock_id',
        comment: '锁箱标识'
    })
    lock_id: string; */

    @Column({
        type: 'decimal',
        precision: 8, 
        scale: 2,
        name: 'cntr_net_wgt',
        comment: '箱净重',
        transformer: decimalTransformer
    })
    cntr_net_wgt: number;

    /* @Column({
        type: 'int',
        name: 'cntr_repair_cod',
        comment: '修箱队'
    })
    cntr_repair_cod: number;*/

    @Column({
        type: 'int',
        name: 'in_truck_sn',
        comment: '进场计划号'
    })
    in_truck_sn: number;

    /*@Column({
        type: 'int',
        name: 'from_plac',
        comment: '来箱地点'
    })
    from_plac: number;

    @Column({
        type: 'varchar',
        name: 'cy_area_no',
        comment: '区号'
    })
    cy_area_no: string;

    @Column({
        type: 'varchar',
        name: 'cy_bay_no',
        comment: '贝号'
    })
    cy_bay_no: string;

    @Column({
        type: 'varchar',
        name: 'cy_row_no',
        comment: '行号'
    })
    cy_row_no: string;

    @Column({
        type: 'varchar',
        name: 'cy_tier_no',
        comment: '高'
    })
    cy_tier_no: string;

    @Column({
        type: 'char',
        name: 'cntr_create_kind',
        comment: '箱产生方式'
    })
    cntr_create_kind: string;

    @Column({
        type: 'varchar',
        name: 'trade_id',
        comment: '贸易性质'
    })
    trade_id: string; */

    @Column({
        type: 'int',
        name: 'cfs_cod',
        comment: '站点'
    })
    cfs_cod: number;

    /* @Column({
        type: 'int',
        name: 'to_plac',
        comment: '发往地点'
    })
    to_plac: number; */

    @Column({
        type: 'varchar',
        name: 'bill_no',
        comment: '收箱提单号'
    })
    bill_no: string;

    @Column({
        type: 'datetime',
        name: 'to_port_tim',
        comment: '进场时间'
    })
    to_port_tim: Date;

    /* @Column({
        type: 'datetime',
        name: 'in_cy_tim',
        comment: '进场落地时间'
    })
    in_cy_tim: Date; */

    /*@Column({
        type: 'varchar',
        name: 'in_truck_no_c',
        comment: '进场车号'
    })
    in_truck_no_c: string;*/

    @Column({
        type: 'varchar',
        name: 'out_truck_no_c',
        comment: '出场车号'
    })
    out_truck_no_c: string;
    @Column({
        type: 'varchar',
        name: 'out_truck_tel',
        comment: '出场司机电话'
    })
    out_truck_tel: string;
    /* @Column({
        type: 'datetime',
        name: 'out_cy_tim',
        comment: '出场时间'
    })
    out_cy_tim: Date; */
    @Column({
        type: 'datetime',
        name: 'allow_date',
        comment: '放箱时间'
    })
    allow_date: Date;

    @Column({
        type: 'datetime',
        name: 'leav_port_tim',
        comment: '离场时间'
    })
    leav_port_tim: Date;

    @Column({
        type: 'int',
        name: 'out_truck_sn',
        comment: '出场计划号'
    })
    out_truck_sn: number;

    @Column({
        type: 'enum',
        enum: RepairStatusType,
        name: 'repair_reply_id',
        comment: '修箱批复标识'
    })
    repair_reply_id: string;

    @Column({
        type: 'datetime',
        name: 'repair_tim',
        comment: '修理时间'
    })
    repair_tim: Date;

    @Column({
        type: 'int',
        name: 'cntr_owner',
        comment: '箱主'
    })
    cntr_owner: number;

    /* @Column({
        type: 'varchar',
        name: 'last_cntr_stat',
        comment: '当前动态'
    })
    last_cntr_stat: string;

     

    @Column({
        type: 'varchar',
        name: 'in_cy_stat',
        comment: '进场动态'
    })
    in_cy_stat: string;

    @Column({
        type: 'varchar',
        name: 'out_cy_stat',
        comment: '出场动态'
    })
    out_cy_stat: string;

    @Column({
        type: 'datetime',
        name: 'last_stat_tim',
        comment: '当前动态时间'
    })
    last_stat_tim: Date;*/

    @Column({
        type: 'varchar',
        name: 'release_no',
        comment: '放箱单号'
    })
    release_no: string;

    /* @Column({
        type: 'varchar',
        name: 'spec_no',
        comment: '特殊单号'
    })
    spec_no: string; */

    @Column({
        type: 'datetime',
        name: 'cntr_date',
        comment: '箱制造日期'
    })
    cntr_date: Date

    @Column({
        type: 'varchar',
        name: 'refmachine_brand',
        comment: '机组品牌'
    })
    refmachine_brand: string;

    @Column({
        type: 'varchar',
        name: 'in_ship_nam',
        comment: '进场船名'
    })
    in_ship_nam: string;

    @Column({
        type: 'varchar',
        name: 'in_voyage',
        comment: '进场航次'
    })
    in_voyage: string;

    @Column({
        type: 'varchar',
        name: 'refmachine_model',
        comment: '机组型号'
    })
    refmachine_model: string;
    @Column({
        type: 'datetime',
        name: 'refmachine_date',
        comment: '机组日期'
    })
    refmachine_date: Date;

    @Column({
        type: 'decimal',
        precision: 8, 
        scale: 2,
        name: 'scale_wgt',
        comment: '箱载重',
        transformer: decimalTransformer
    })
    scale_wgt: number;

    @Column({
        type: 'int',
        name: 'free_days',
        comment: '免堆天数'
    })
    free_days: number;

    @Column({
        type: 'varchar',
        name: 'in_reason',
        comment: '进箱原因'
    })
    in_reason: string;
    
    @OneToMany(() => FeeDet, (feedet) => feedet.cntr)
    feedets: FeeDet[];

    @OneToMany(() => CntrLease, (cntrlease) => cntrlease.cntr)
    leases: CntrLease[];

    @ManyToOne(() => CntrInPlan, (inplan) => inplan.cntrs)
    @JoinColumn({
        name: 'in_truck_sn'
    })
    inplan: CntrInPlan;

    @OneToMany(() => PortCntrStat, (portcntrstat) => portcntrstat.cntrfile)
    cntrStats: PortCntrStat[];
}

@Entity({
    name: 'v_current_cntr_file'
})
export class VCurrentCntr extends Cntr {}

@Entity({
    name: 'v_cntr_file'
})
export class VCntr extends Cntr {
    @Column({
        type: 'varchar',
        name: 'in_plan_name',
        comment: '进场计划名称'
    })
    in_plan_name: string;
    @Column({
        type: 'varchar',
        name: 'out_plan_name',
        comment: '出场计划名称'
    })
    out_plan_name: string;

    /* @Column({
        type: 'int',
        name: 'stack_days',
        comment: '付费堆存天数'
    })
    stack_days: number;

     @Column({
        type: 'varchar',
        name: 'fee0101currency',
        comment: '购箱费货币'
    })
    fee0101currency: string;

    @Column({
        type: 'decimal',
        name: 'fee0101amount',
        comment: '购箱费',
        transformer: decimalTransformer
    })
    fee0101amount: number;

    @Column({
        type: 'varchar',
        name: 'fee0103currency',
        comment: '售箱费货币'
    })
    fee0103currency: string;

    @Column({
        type: 'decimal',
        name: 'fee0103amount',
        comment: '售箱费',
        transformer: decimalTransformer
    })
    fee0103amount: number; */
}

@Entity({
    name: 'fix_list'
})
export class CntrFixItem extends YhBaseEntity {
    @Column({
        type: 'int',
        name: 'cntr_no',
        comment: '箱编号'
    })
    cntr_no: number;

    @Column({
        type: 'varchar',
        name: 'fix_item_nam',
        comment: '修理项目'
    })
    fix_item_nam: string;

    @Column({
        type: 'datetime',
        name: 'fix_tim',
        comment: '修理时间'
    })
    fix_tim: Date;

    @Column({
        type: 'decimal',
        precision: 8,
        scale: 2,
        name: 'total_money',
        comment: '修理金额',
        transformer: decimalTransformer
    })
    total_money: number;

    /* @Column({
        type: 'decimal',
        precision: 8,
        scale: 2,
        name: 'ret_total_money',
        comment: '批复金额',
        transformer: decimalTransformer
    })
    ret_total_money: number; */
}

@Entity({
    name: 'fix_reply'
})
export class FixReply extends YhBaseEntity {
    @Column({
        type: 'int',
        name: 'cntr_no',
        comment: '箱编号'
    })
    cntr_no: number;

    @Column({
        type: 'datetime',
        name: 'msg_time',
        comment: '发言时间'
    })
    msg_time: Date;

    @Column({
        type: 'enum',
        enum: RepairStatusType,
        name: 'reply_id',
        comment: '修箱批复标识'
    })
    reply_id: string;
    
    @Column({
        type: 'varchar',
        name: 'oper_name',
        comment: '发言人'
    })
    oper_name: string;

    @Column({
        type: 'varchar',
        name: 'msg',
        comment: '留言内容'
    })
    msg: string;
    
}

@Entity({
    name: 'v_fix_quotation'
})
export class VFixQuotation {
    @PrimaryColumn({
        type: 'int',
        name: 'cntr_no',
        comment: '箱编号'
    })
    cntr_no: number;

    @Column({
        type: 'varchar',
        name: 'cntr',
        comment: '箱号'
    })
    cntr: string;


    @Column({
        type: 'varchar',
        name: 'cntr_siz_cod',
        comment: '尺寸'
    })
    cntr_siz_cod: string;

    @Column({
        type: 'varchar',
        name: 'cntr_typ_cod',
        comment: '箱型'
    })
    cntr_typ_cod: string;

    @Column({
        type: 'int',
        name: 'cntr_owner',
        comment: '箱主'
    })
    cntr_owner: number;

    @Column({
        type: 'int',
        name: 'cfs_cod',
        comment: '站点'
    })
    cfs_cod: number;


    @Column({
        type: 'enum',
        name: 'repair_reply_id',
        enum: RepairStatusType,
        comment: '修箱报价状态'
    })
    repair_reply_id: string;

    @Column({
        type: 'datetime',
        name: 'repair_tim',
        comment: '报价时间'
    })
    repair_tim: Date;

    @Column({
        type: 'decimal',
        precision: 10,
        scale: 2,
        name: 'fix_amount',
        comment: '修箱费',
        transformer: decimalTransformer
    })
    fix_amount: number;
}

@Entity({
    name: 'v_inventory'
})
export class VInventory extends YhBaseEntity{
    @Column({
        type: 'varchar',
        name: 'cntr',
        comment: '箱号'
    })
    cntr: string;
    @Column({
        type: 'varchar',
        name: 'dam_id',
        comment: '当前箱况'
    })
    dam_id: string;

    @Column({
        type: 'char',
        name: 'cntr_siz_cod',
        comment: '箱尺寸'
    })
    cntr_siz_cod: string;

    @Column({
        type: 'char',
        name: 'cntr_typ_cod',
        comment: '箱型'
    })
    cntr_typ_cod: string;

    @Column({
        type: 'int',
        name: 'cfs_cod',
        comment: '站点'
    })
    cfs_cod: number;

    @Column({
        type: 'datetime',
        name: 'to_port_tim',
        comment: '进场时间'
    })
    to_port_tim: Date;

    @Column({
        type: 'int',
        name: 'free_days',
        comment: '免堆天数'
    })
    free_days: number;

    /* @Column({
        type: 'int',
        name: 'stack_days',
        comment: '堆存天数'
    })
    stack_days: number; */
}

@Entity({
    name: 'v_inventory_group'
})
export class VInventoryGroup {
    @PrimaryColumn({
        type: 'varchar',
        name: 'cfs_cod',
        comment: '站点代码'
    })
    cfs_cod: string;

    @PrimaryColumn({
        type: 'varchar',
        name: 'cntr_siz_cod',
        comment: '尺寸'
    })
    cntr_siz_cod: string;
    @PrimaryColumn({
        type: 'varchar',
        name: 'cntr_typ_cod',
        comment: '箱型代码'
    })
    cntr_typ_cod: string;

    @PrimaryColumn({
        type: 'varchar',
        name: 'dam_id',
        comment: '箱况'
    })
    dam_id: string;

    @Column({
        type: 'int',
        name: 'count',
        comment: '箱量'
    })
    count: number;
}



@Entity({
    name: 'port_cntr_stat'
})
export class PortCntrStat extends YhBaseEntity {
    @Column({
        type: 'int',
        name: 'cntr_no',
        comment: '箱ID'
    })
    cntr_no: number;

    @Column({
        type: 'varchar',
        name: 'cntr',
        comment: '箱号'
    })
    cntr: string;

    @Column({
        type: 'varchar',
        name: 'cntr_stat_cod',
        comment: '动态代码'
    })
    cntr_stat_cod: string;

    @Column({
        type: 'datetime',
        name: 'stat_tim',
        comment: '动态时间'
    })
    stat_tim: Date;
    @Column({
        type: 'varchar',
        name: 'current_stat',
        comment: '箱状态'
    })
    current_stat: string;

    @Column({
        type: 'int',
        name: 'cfs_cod',
        comment: '堆场'
    })
    cfs_cod: number;
    @Column({
        type: 'int',
        name: 'plan_id',
        comment: '计划id'
    })
    plan_id: number;

    @Column({
        type: 'varchar',
        name: 'bill_no',
        comment: '提单号'
    })
    bill_no: string;

    @Column({
        type: 'varchar',
        name: 'dam_id',
        comment: '箱况'
    })
    dam_id: string;

    @Column({
        type: 'char',
        name: 'cal_stack',
        comment: '计算堆存费标识'
    })
    cal_stack: string;
    /* @Column({
        type: 'varchar',
        name: 'in_cy_id',
        comment: '在场标示'
    })
    in_cy_id: string;

    @Column({
        type: 'varchar',
        name: 'e_f_id',
        comment: '空重'
    })
    e_f_id: string;

    @Column({
        type: 'varchar',
        name: 'cntr_plac',
        comment: '箱位'
    })
    cntr_plac: string;

    @Column({
        type: 'varchar',
        name: 'cntr_siz_cod',
        comment: '尺寸'
    })
    cntr_siz_cod: string;

    @Column({
        type: 'varchar',
        name: 'cntr_typ_cod',
        comment: '箱型'
    })
    cntr_typ_cod: string; */

    @Column({
        type: 'varchar',
        name: 'truck_no',
        comment: '车号'
    })
    truck_no: string;
    @Column({
        type: 'varchar',
        name: 'driver_tel',
        comment: '司机电话'
    })
    driver_tel: string;

    /* @Column({
        type: 'enum',
        name: 'send_id',
        enum: BooleanType,
        comment: '动态发送标识',
    })
    send_id: string; */

    @Column({
        type: 'varchar',
        name: 'upd_table',
        comment: '更新sql'
    })
    upd_table: string;

    @Column({
        type: 'varchar',
        name: 'ins_table',
        comment: '插入sql'
    })
    ins_table: string;

    @Column({
        type: 'varchar',
        name: 'del_table',
        comment: '删除时sql'
    })
    del_table: string;

    @ManyToOne(() => Cntr, (cntr) => cntr.cntrStats)
    @JoinColumn({
        name: 'cntr_no'
    })
    cntrfile: Cntr;
    
    @ManyToOne(() => CyCfs, (cfs) => cfs.cntrStats)
    @JoinColumn({
        name: 'cfs_cod'
    })
    Cfs: CyCfs;

    @ManyToOne(() => CntrPlan, (cntrplan) => cntrplan.portcntrstats)
    @JoinColumn({
        name: 'plan_id'
    })
    plan: CntrPlan;
}

@Entity({
    name: 'cntr_lease'
})
export class CntrLease extends YhBaseEntity {
    @Column({
        type: 'int',
        name: 'cntr_no',
        comment: '箱编号'
    })
    cntr_no: number;

    @Column({
        type: 'int',
        name: 'lease_sn',
        comment: '起租计划号'
    })
    lease_sn: number;

    @Column({
        type: 'int',
        name: 'out_cfs',
        comment: '起租场站'
    })
    out_cfs: number;

    @Column({
        type: 'datetime',
        name: 'out_date',
        comment: '起租日期'
    })
    out_date: Date;

    @Column({
        type: 'varchar',
        name: 'out_truck_no_c',
        comment: '离场车号'
    })
    out_truck_no_c: string;

    @Column({
        type: 'varchar',
        name: 'out_driver_tel',
        comment: '离场司机电话'
    })
    out_driver_tel: string;

    @Column({
        type: 'int',
        name: 'rent_sn',
        comment: '退租计划号'
    })
    rent_sn: number;
    @Column({
        type: 'int',
        name: 'back_cfs',
        comment: '退租场站'
    })
    back_cfs: number;

    @Column({
        type: 'datetime',
        name: 'back_date',
        comment: '返回日期'
    })
    back_date: Date;
    @Column({
        type: 'varchar',
        name: 'back_truck_no_c',
        comment: '返场车号'
    })
    back_truck_no_c: string;

    @Column({
        type: 'varchar',
        name: 'back_driver_tel',
        comment: '返场司机电话'
    })
    back_driver_tel: string;

    
    
    @Column({
        type: 'decimal',
        name: 'day_rate',
        comment: '出租费率',
        transformer: decimalTransformer
    })
    day_rate: number;   
    @Column({
        type: 'varchar',
        name: 'currency_cod',
        comment: '货币'
    }) 
    currency_cod: string;

    @ManyToOne(() => Cntr, (cntr) => cntr.leases)
    @JoinColumn({
        name: 'cntr_no'
    })
    cntr: Cntr;

    @ManyToOne(() => CntrLeasePlan, (leaseplan) => leaseplan.leasecntrs)
    @JoinColumn({
        name: 'lease_sn'
    })
    leaseplan: CntrLeasePlan;

    @ManyToOne(() => CntrRentPlan, (rentplan) => rentplan.leasecntrs)
    @JoinColumn({
        name: 'rent_sn'
    })
    rentplan: CntrRentPlan;
}

@Entity({
    name: 'v_cntr_lease'
})
export class VCntrLease extends YhBaseEntity {
    @Column({
        type: 'int',
        name: 'cntr_no',
        comment: '箱编号'
    })
    cntr_no: number;

    @Column({
        type: 'varchar',
        name: 'cntr',
        comment: '箱号'
    })
    cntr: string;
    
    @Column({
        type: 'char',
        name: 'cntr_siz_cod',
        comment: '箱尺寸'
    })
    cntr_siz_cod: string;

    @Column({
        type: 'char',
        name: 'cntr_typ_cod',
        comment: '箱型'
    })
    cntr_typ_cod: string;

    


    

    @Column({
        type: 'int',
        name: 'lease_sn',
        comment: '起租计划号'
    })
    lease_sn: number;
    @Column({
        type: 'int',
        name: 'out_cfs',
        comment: '起租站点'
    })
    out_cfs: number;

    @Column({
        type: 'datetime',
        name: 'out_date',
        comment: '起租日期'
    })
    out_date: Date;

    @Column({
        type: 'varchar',
        name: 'out_truck_no_c',
        comment: '离场车号'
    })
    out_truck_no_c: string;

    @Column({
        type: 'varchar',
        name: 'out_driver_tel',
        comment: '离场司机电话'
    })
    out_driver_tel: string;
    
    @Column({
        type: 'decimal',
        name: 'day_rate',
        comment: '出租费率',
        transformer: decimalTransformer
    })
    day_rate: number;   
    @Column({
        type: 'varchar',
        name: 'currency_cod',
        comment: '货币'
    }) 
    currency_cod: string;

    @Column({
        type: 'int',
        name: 'rent_sn',
        comment: '退租计划号'
    })
    rent_sn: number;
    @Column({
        type: 'int',
        name: 'back_cfs',
        comment: '退租站点'
    })
    back_cfs: number;
    @Column({
        type: 'datetime',
        name: 'back_date',
        comment: '退租日期'
    })
    back_date: Date;
    @Column({
        type: 'varchar',
        name: 'back_truck_no_c',
        comment: '返场车号'
    })
    back_truck_no_c: string;

    @Column({
        type: 'varchar',
        name: 'back_driver_tel',
        comment: '返场司机电话'
    })
    back_driver_tel: string;



    @Column({
        type: 'varchar',
        name: 'plan_name',
        comment: '起租计划名称'
    })
    plan_name: string;

    @Column({
        type: 'int',
        name: 'cntr_num',
        comment: '箱量'
    })
    cntr_num: number;

    @Column({
        type: 'enum',
        enum: BooleanType,
        name: 'finish_id',
        comment: '完成标识'
    })
    finish_id: BooleanType;

    @Column({
        type: 'int',
        name: 'cntr_corp_cod',
        comment: '客户'
    })
    cntr_corp_cod: number;;

    @Column({
        type: 'varchar',
        name: 'bill_no',
        comment: '放箱单号'
    })
    bill_no: string;
    
}

@Entity({
    name: 'release_form'
})
export class LeaseForm extends YhBaseEntity {

    @Column({
        type: 'int',
        name: 'plan_id',
        comment: '计划号'
    })
    plan_id: number;
    @Column({
        type: 'varchar',
        name: 'release_no',
        comment: '放箱号'
    })
    release_no: string;

    @Column({
        type: 'int',
        name: 'cntr_num',
        comment: '箱量'
    })
    cntr_num: number;
    @Column({
        type: 'varchar',
        name: 'cntr_siz_cod',
        comment: '箱尺寸'
    })
    cntr_siz_cod: string;
    @Column({
        type: 'varchar',
        name: 'cntr_typ_cod',
        comment: '箱型'
    })
    cntr_typ_cod: string;
    @Column({
        type: 'varchar',
        name: 'dam_id',
        comment: '箱况'
    })
    dam_id: string;

    @Column({
        type: 'varchar',
        name: 'cntr_info',
        comment: '箱号信息'
    })
    cntr_info: string;

    @Column({
        type: 'varchar',
        name: 'oper_nam',
        comment: '操作员'
    })
    oper_nam: string;
    @Column({
        type: 'datetime',
        name: 'create_tim',
        comment: '放箱日期'
    })
    create_tim: Date;

    @Column({
        type: 'int',
        name: 'cfs_cod',
        comment: '站点'
    })
    cfs_cod: number;
    @Column({
        type: 'varchar',
        name: 'filepath',
        comment: 'pdf文件路径'
    })
    filepath: string;
    @Column({
        type: 'varchar',
        name: 'form_style',
        comment: '放箱单格式'
    })
    form_style: string;
}